import axios from 'axios';

axios.interceptors.request.use(
    config => {
        const token = localStorage.getItem('token');
        if (token) {
            config.headers['Authorization'] = 'Bearer ' + token;  // 将Token添加到请求头
        }
        return config;
    },
    error => Promise.reject(error)
);